//
//  UtilsMacros.h
//  ACE
//
//  Created by Mickey Yin on 2021/12/1.
//

#ifndef UtilsMacros_h
#define UtilsMacros_h


#pragma mark ---- CGRectMake

#define KScreenW ([UIScreen mainScreen].bounds.size.width)
#define KScreenH ([UIScreen mainScreen].bounds.size.height)
#define KSCREEN_BOUNDS  [UIScreen mainScreen].bounds

#define SCREEN_MAX_LENGTH (MAX(KScreenW, KScreenH))
#define SCREEN_MIN_LENGTH (MIN(KScreenW, KScreenH))

#define YXStatusBarHeight [UIApplication sharedApplication].statusBarFrame.size.height
#define YXNavigationBarHeight (YXStatusBarHeight + 44)
#define iPhoneTabbarHeight (49 + (isIPhoneX ? (iPhoneXTabbarAddHeight) : 20))



//判断是否为iPhone
#define kIs_iphone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
//判断是否为iPhoneX
#define kIs_iPhoneX KScreenW >=375.0f && KScreenH >=812.0f && kIs_iphone
//判断是否为iPad
#define kISiPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define iPhone6 (kIs_iphone && SCREEN_MAX_LENGTH == 667.0)

/*状态栏高度*/
#define kStatusBarHeight (CGFloat)(kIs_iPhoneX?(44.0):(20.0))
///*导航栏高度*/
//#define kNavBarHeight (44)
/*状态栏和导航栏总高度*/
#define kNavBarAndStatusBarHeight (CGFloat)(kIs_iPhoneX?(88.0):(64.0))
/*TabBar高度*/
#define kTabBarHeight (CGFloat)(kIs_iPhoneX?(49.0 + 34.0):(49.0))
/*顶部安全区域远离高度*/
#define kTopBarSafeHeight (CGFloat)(kIs_iPhoneX?(44.0):(0))
 /*底部安全区域远离高度*/
#define kBottomSafeHeight (CGFloat)(kIs_iPhoneX?(34.0):(0))
/*iPhoneX的状态栏高度差值*/
#define kTopBarDifHeight (CGFloat)(kIs_iPhoneX?(24.0):(0))
/*导航条和Tabbar总高度*/
#define kNavAndTabHeight (kNavBarAndStatusBarHeight + kTabBarHeight)



// 等比例缩放系数
#define SCREEN_SCALE     ((kScreenW > 414) ? (kScreenH/375.0) : (kScreenW/375.0))
#define Handle(x)        ((x)*SCREEN_SCALE)
#define HandleWidth(w)   ((w)*SCREEN_SCALE)
#define HandleHeight(h)  ((h)*SCREEN_SCALE)


#pragma mark ---- 系统宏
//APP对象 （单例对象）
#define kApplication         [UIApplication sharedApplication]
//主窗口 （keyWindow）
#define kKeyWindow           [UIApplication sharedApplication].keyWindow
//APP对象的delegate
#define kAppDelegate         [UIApplication sharedApplication].delegate
//NSUserDefaults实例化
#define kUserDefaults        [NSUserDefaults standardUserDefaults]
//通知中心 （单例对象）
#define kNotificationCenter  [NSNotificationCenter defaultCenter]

#endif /* UtilsMacros_h */
